package com.dxx.cloud.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dxx.cloud.admin.mapper.SysConfigMapper;
import com.dxx.cloud.admin.module.entity.SysConfigEntity;
import com.dxx.cloud.admin.service.ISysConfigService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 * 系统配置 服务实现类
 * </p>
 *
 * @author dh
 * @since 2025-06-06
 */
@Service
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfigEntity> implements ISysConfigService {
    @Override
    public String getValue(String type, String name) {
        SysConfigEntity one = getOne(new LambdaQueryWrapper<SysConfigEntity>().eq(SysConfigEntity::getType, type).eq(StringUtils.hasText(name), SysConfigEntity::getName, name), false);
        if(null == one) {
            return null;
        }
        return one.getValue();
    }
}
